package com.hdaccp.shuiguoD.controller;

import com.hdaccp.shuiguoD.service.CangkuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/cangku")
@Scope("prototype")
public class CangkuController {

    @Autowired
    private CangkuService cangkuService;

    @RequestMapping("/queryAll")
    @ResponseBody
    public Map<String,Object> queryAll(int offset, int limit){
        /* Map<String,Object> map = new HashMap<>() ;
        map.put("rows",userInfoService.findAll(offset,limit)) ;
        map.put("total",userInfoService.findTotalCount()) ;
        return  map ;*/

        return null;
    }

    /*  @RequestMapping("/queryAll")
      @ResponseBody
      public List<Kehu> queryAll(){

          return kehuService.getAll();

      }
  */
    @RequestMapping("/querySearch")
    @ResponseBody
    public Map<String,Object> querySearch(String cname, int offset, int limit){
        Map<String,Object> map = new HashMap<>();
        map.put("rows",cangkuService.findAll(cname,offset,limit));
        map.put("total",cangkuService.findTotalCount(cname));
        return map;
    }
}
